﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Profile;
using System.Data;

namespace WebSite.cn
{
    public partial class score : System.Web.UI.Page
    {
        // Fields
        public string score1 = "0";
        public string score2 = "0";
        public string score3 = "0";
        public string scoremsg = "";

        // Methods
        private void Bind()
        {
            DataTable table = SQLAccess.GreatDs("select * from DB_Score where memberid=" + this.Session["memberid"] + "").Tables[0];
            if (table.Rows.Count > 0)
            {
                foreach (DataRow row in table.Rows)
                {
                    this.scoremsg = this.scoremsg + "<tr>";
                    this.scoremsg = this.scoremsg + "<td height='28' align='center' bgcolor='#FFFFFF'>" + row["scorename"].ToString() + "</td>";
                    this.scoremsg = this.scoremsg + "<td align='center' bgcolor='#FFFFFF'>";
                    if (row["scoretype"].ToString() == "0")
                    {
                        this.scoremsg = this.scoremsg + "" + row["scoreprice"].ToString() + "";
                    }
                    else
                    {
                        this.scoremsg = this.scoremsg + "<span class='text_red'>" + row["scoreprice"].ToString() + "</span>";
                    }
                    this.scoremsg = this.scoremsg + "</td><td align='center' bgcolor='#FFFFFF'>" + row["content"].ToString() + "</td>";
                    this.scoremsg = this.scoremsg + "<td align='center' bgcolor='#FFFFFF'>" + row["updatetime"].ToString() + "</td></tr>";
                }
            }
            table = SQLAccess.GreatDs("select score1,score2,score3 from DB_Member where memberid=" + this.Session["memberid"] + "").Tables[0];
            if (table.Rows.Count > 0)
            {
                this.score1 = table.Rows[0]["score1"].ToString();
                this.score2 = table.Rows[0]["score2"].ToString();
                this.score3 = table.Rows[0]["score3"].ToString();
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                if (this.Session["memberid"] != null)
                {
                    this.Bind();
                }
                else
                {
                    base.Response.Write("<script language=javascript>window.location.href='index.aspx';</script>");
                    base.Response.End();
                }
            }
        }

    }
}